<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
	$(function() {
		parent.$.messager.progress('close');
		$('#form').form({
			url : '${pageContext.request.contextPath}/userController/add?',
			onSubmit : function() {
				parent.$.messager.progress({
					title : '提示',
					text : '数据处理中，请稍后....'
				});
				var isValid = $(this).form('validate');
				if (!isValid) {
					parent.$.messager.progress('close');
				}
				return isValid;
			},
			success : function(result) {
				parent.$.messager.progress('close');
				result = $.parseJSON(result);
				if (result.success) {
					parent.$.messager.alert('成功', result.msg, 'info');
					
					parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
					parent.$.modalDialog.handler.dialog('close');
				} else {
					parent.$.messager.alert('错误', result.msg, 'error');
				}
			}
		});
	});
	 $.extend($.fn.validatebox.defaults.rules,{  //验证密码
		 isPassword:{
		    validator:function(value){
		    	   var patrn=/^(?=.*[0-9].*)(?=.*[a-zA-Z].*).{8,16}$/;   
		    			if (!patrn.exec(value)) {
		    				return false ;
		    			}
		    			return true; 
		    },
		    message:"密码必须同时包含数字,字母与其他字符."
		    }    
		});  

</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow: hidden;">
		<form id="form" method="post">
			<table class="table table-hover table-condensed">
				<tr>
					<th>id</th>
					<td><input name="id" type="text" class="span2" value="${user.id}" readonly="readonly"></td>
					<th>编号</th>
					<td><input name="name" type="text" class="span2" value="自动生成" readonly="readonly"></td>
				</tr>
				<tr>
					<th>密码</th>
					<td><input name="pwd" type="password" placeholder="请输入密码" class="easyui-validatebox span2" data-options="required:true,validType:['length[8,16]','isPassword']" value="~123456y"></td>
					<th>姓名</th>
					<td><input name="rname" type="text" placeholder="请输入姓名" class="easyui-validatebox span2" data-options="required:true" value="用户"></td>
				</tr>
				<tr>
					<th>身份证</th>
					<td><input name="idn" type="text" placeholder="请输入身份证" class="easyui-validatebox span2" data-options="required:true,validType:['idCardNo'] " value="452725199209110212"></td>
					<th>电话</th>
					<td><input name="tel" type="text" placeholder="请输入电话" class="easyui-validatebox span2" data-options="required:true,validType:['mobileTelephone'] "  " value="18204311111"></td>
				</tr>
				<tr>
					<th>地址</th>
					<td><input name="address" type="text" placeholder="请输入地址" class="easyui-validatebox span2" data-options="required:true" value="某个地址"></td>
					<th>部门</th>
					<td>
					<select id="cc" class="easyui-combobox" name="type" style="width:150px;">   
					    <option value="1">储蓄</option>   
					    <option value="2">信用卡</option>   
					    <option value="3">贷款</option>   
					    <option value="4">管理</option>   
					</select> 
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>